package com.camps.sdk.encrypt;

import com.camps.sdk.common.ExceptionCode;
import com.camps.sdk.entity.Volume;
import com.camps.sdk.exception.BaseException;

/**
 * @Author ldaoliang
 * @Date create in 10:11 2021/9/1
 * @Description
 */
public class SetVolumeCommand implements BuildCommand {
    @Override
    public String splicingParameters(String imei, Object params) {
        if(!(params instanceof Volume)){
            throw new BaseException(ExceptionCode.PARAMETER_ERROR);
        }
        Volume volume = (Volume)params;
        Integer volumeLevel = volume.getVolumeLevel();
        String commandNumber = volume.getCommandNumber();
        StringBuilder sb = new StringBuilder("*WT,");
        sb = sb.append(imei).append(",SPEAKER,").append(commandNumber).append(",").append(volumeLevel).append("#");
        return sb.toString();
    }
}
